package com.example.mallsystem1104.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.mallsystem1104.common.Result;
import com.example.mallsystem1104.entity.Category;
import com.example.mallsystem1104.service.CarouselService;
import com.example.mallsystem1104.service.CategoryService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author zy
 * @Date 2024/12/12 10:45
 * @packageName:com.example.mallsystem1104.controller
 * @ClassName:CategoryController
 */
@RestController
@RequestMapping("/api/category")
@CrossOrigin
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    public CategoryController(CategoryService categoryService) {
        this.categoryService = categoryService;
    }
    @GetMapping
    public Result findAll(){
//        QueryWrapper<Category> queryWrapper=new QueryWrapper<>();
//        List<Category> list=categoryService.list(queryWrapper);
//        return Result.success(list);

        List<Category> list=categoryService.list();
        return Result.success(list);
    }
}
